﻿@{
    Layout = null;
}
@using Dnc.Extensions.Ui.Layui.Demo.Models
@model DemoModel
<!DOCTYPE html>
<html>
<head>
    <title>首页 -  Powered By Vinotec</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="icon" href="~/favicon.ico" />
    <link rel="shortcut icon" href="~/favicon.ico" />
    <link rel="stylesheet" href="~/lib/layui/css/layui.css" />

    <script type="text/javascript" charset="utf-8" src="~/lib/UEditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="~/lib/UEditor/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="~/lib/UEditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo">layui 后台布局</div>
            <!-- 头部区域（可配合layui已有的水平导航） -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item"><a href="">控制台</a></li>
                <li class="layui-nav-item"><a href="">商品管理</a></li>
                <li class="layui-nav-item"><a href="">用户</a></li>
                <li class="layui-nav-item">
                    <a href="javascript:;">其它系统</a>
                    <dl class="layui-nav-child">
                        <dd><a href="">邮件管理</a></dd>
                        <dd><a href="">消息管理</a></dd>
                        <dd><a href="">授权管理</a></dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                        贤心
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="">基本资料</a></dd>
                        <dd><a href="">安全设置</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="">退了</a></li>
            </ul>
        </div>

        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;">所有列表</a>
                        <dl class="layui-nav-child">
                            <dd><a href="/">页面1</a></dd>
                            <dd><a href="/Home/Index2">页面2</a></dd>
                            <dd><a href="/Home/Index3">页面3</a></dd>
                            
                        </dl>
                    </li>
                </ul>
            </div>
        </div>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">
                @using (Html.BeginForm<DemoModel>("#"))
                {
                    @Html.InputFor(x => x.Id)
                    @Html.InputFor(x => x.Actor)
                    @Html.InputFor(x => x.Name, x => x.Mobile)
                    @Html.InputFor(x => x.Url, x => x.Email)
                    @Html.InputFor(x => x.OrderIndex, x => x.Dec)
                    @Html.InputFor(x => x.Sex)
                    @Html.InputFor(x => x.Switch, x => x.Date)
                    @Html.InputFor(x => x.Year, x => x.Month)
                    @Html.InputFor(x => x.Remark)
                    @Html.InputFor(x => x.Editor)

                    @Html.ActionsForSubmitAndClose()
                }
            </div>
        </div>

        <div class="layui-footer">
            <!-- 底部固定区域 -->
            © layui.com - 底部固定区域
        </div>
    </div>

    <environment names="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/lib/jquery/dist/jquery.min.js"></script>
    </environment>
    <script src="~/lib/jquery.serializejson.min.js"></script>
    <script src="~/lib/layui/layui.js"></script>
    <script src="~/js/form.verify.js"></script>
    <script>
        var upload;
        //JavaScript代码区域
        layui.use(['element', 'form', 'laydate','upload'], function () {
            var element = layui.element;
            var $ = layui.jquery;
            var laydate = layui.laydate;
            var form = layui.form;
            upload = layui.upload;
            //含有日期/时间/年份/年月字段的时候
            $(".layui-input.laydate").each(function () {
                var self = $(this);
                var type = self.data("type") || 'date';
                var format = self.data("format") || 'yyyy-MM-dd';
                laydate.render({
                    elem: self[0],
                    type: type,
                    format: format
                });
            });
            form.on("submit", function (data) {
                alert($(data).serializeJSON());
                return false;
            });

            //含有编辑器字段的时候
            $(".generateeditor").each(function (index, dom) {
                UE.getEditor($(dom).attr("id"));
            });


             //含有imgage / imageurl 字段的时候
             $(".layui-upload-drag").each(function (index, dom) {
                 InitUpload(dom);
             });
            
        });

        /**
         * 含有imgage / imageurl 字段的时候
         * @@param dom
         */
        function InitUpload(dom) {
            var upload_dom_id = $(dom).attr("id");
            var upload_input_tag = $(dom).attr("upload_input_tag");
            var upload_input_perview = $(dom).attr("upload_input_perview");
            //拖拽上传
            upload.render({
                elem: '#' + upload_dom_id
                , url: 'https://httpbin.org/post' //改成您自己的上传接口
                , done: function (res) {
                    layer.msg('上传成功');
                    layui.$('#' + upload_input_perview).removeClass('layui-hide').find('img').attr('src', res.files.file);
                    console.log(res)
                }
            });
        }


    </script>
</body>
</html>